<template>
    <view class="identityPage">
		<text class="title">{{title}}</text>
		<block v-if="infos.census === 'huDouble'">
			<block v-for="(item,index) in doubleList" :key="index">
				<view class="inpItem">
					<text>{{item.label}}</text>
					<view class="inpBox flex">
						<up-number-box v-model="item.value" input-width="150" input-height="70" @change="valChange(item)"></up-number-box>
					</view>
				</view>
			</block>
		</block>

		<button class="assessBtn" @click="assessBtn">立即评估</button>

		<up-modal :show="showModelTxt" :closeOnClickOverlay="true" @close="showModelTxt=false" @confirm="showModelTxt=false">
			<view class="contentWrap flex">
				<view class="txtWrap flex bg-theme text-center col-fff font20 fontBold">
					<view>
						<view v-for="(item, index) in titList" :key="index">{{ item }}</view>
					</view>
				</view>
			</view>
		</up-modal>
    </view>
</template>

<script>
	import { doubleCensus } from '@/common/purchase';
	export default {
        data() {
            return {
				title: "夫妻双方共同与父母拥有外环内的房屋套数?",
				doubleList: [],
				countHouse: 2,
				infos: {},
				showModelTxt: false,
				titList: []
            }
        },
        //分享
        onShareAppMessage(res) {
        	return {
        		title: "上海限购查询，快来测测限购几套",
        		path: `/pages/tools/purchase/identity`,
        	}
        },
        onLoad(options){
			this.doubleList = doubleCensus;
            this.infos = JSON.parse(options.info);
        },
		methods:{
			valChange(info){
			},
			assessBtn(){
				let totalNum = 0;//已经占有份额
				
				//已婚双户籍
				this.countHouse = 2;
				this.doubleList.forEach(item => {
					if(item.before) {
						if(Number(item.value) === 3) {
							totalNum += 1
						}else if(Number(item.value) > 3) {
							totalNum += 2
						}
					}else {
						if(Number(item.value) === 1){
							totalNum += 1
						}else if(Number(item.value) > 1){
							totalNum += 2
						}
					}
				})
				
				switch(this.countHouse - totalNum){
					case 2:
					this.titList = ['外环外不限购','外环内可再购2套'];
					break;
					
					case 1:
					this.titList = ['外环外不限购','外环内可再购1套'];
					break;
					
					case 0:
					this.titList = ['外环外不限购','外环内限购'];
					break;
					
					default:
					this.titList = ['外环外不限购','外环内限购'];
					break
				}
				this.showModelTxt = true;
			}
		}
    }
</script>

<style scoped lang="scss">
	.identityPage{
		text-align: center;
		::v-deep .u-modal__content{
            padding: 0 !important;
            display: block !important;
        }
		.title{
			margin-top: 20vh;
			font-size: 40rpx;
			display: block;
		}
		.inpItem{
			margin-top: 20rpx;
			text{
				display: block;
			}
			.inpBox{
				margin-top: 15rpx;
			}
		}
		.assessBtn{
			width: 70vw;
			margin-top: 40rpx;
			margin-bottom: 40rpx;
			background-color: $theme-color;
			color: #FFFFFF;
		}
		.slot-content{
			width: 100%;
		}
		.contentWrap{
			padding: 40rpx 0;
			.txtWrap{
				padding: 20rpx;
				width: 40vw;
				height: 40vw;
				line-height: 1.4;
				border-radius: 50%;
			}
			.pangFigure{
				width: 40vw;
				margin-left: -64rpx;
			}
		}
	}

</style>
